<template>
	<el-table :data="priceTable">
		<el-table-column width="100" property="text" align="right" label="项目" />
		<el-table-column width="100" property="value" align="right" label="金额">
			<template #default="scope">
				<span v-if="scope.row.value > 0 && scope.row.is_color > 0" style="color: red">+ ￥{{ getMoneyByMinute(scope.row.value) }}</span>
				<span v-else-if="scope.row.value < 0 && scope.row.is_color > 0" style="color: green">- ￥{{ getMoneyByMinute(scope.row.value) }}</span>
				<span v-else>￥{{ getMoneyByMinute(scope.row.value) }}</span>
			</template>
		</el-table-column>
	</el-table>
</template>

<script>
export default {
	name: "order-price-table",
	props: {
		priceTable: { type: Array, default: () => [] }
	},
	methods: {
		getMoneyByMinute(_value) {
			return this.$TOOL.getMoneyByMinute(Math.abs(_value));
		},
		getMoneyColor(_value) {
			if (_value > 0) {
				return "color:red;";
			} else if (_value < 0) {
				return "color:green;";
			} else {
				return "";
			}
		}
	}
};
</script>

<style scoped></style>
